package cn.wizzer.app.web.modules.controllers.cms;

import cn.wizzer.app.cms.modules.services.CmsBannerService;
import cn.wizzer.app.cms.modules.models.CmsBanner;
import cn.wizzer.framework.util.Result;
import cn.wizzer.framework.util.param.ParamVerify;
import com.alibaba.dubbo.config.annotation.Reference;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;

import java.util.List;

@At("/cms/banner")
@IocBean
public class ApiBannerController {

    @Reference
    @Inject
    private CmsBannerService bannerService;

    /**
     * 根据类型查询广告信息
     */
    @At("/list")
    @Ok("json:{locked:'remark'}")
    public Result findBanner(@ParamVerify(required = true) String language,@ParamVerify String type) {
        List<CmsBanner> cmsBannerList = bannerService.queryByLanguage(language,type);
        return Result.success().addData(cmsBannerList);
    }
}
